import type {
  PatientInfoByIdParams,
  PatientItem,
  PatientParams,
  PatientUpdateParams,
} from '@/types/patient'
import { request } from '@/utils/request'

/**
 * 添加患者（家庭档案）
 */
export const addPatientApi = (data: PatientParams) => {
  return request('/patient/add', 'POST', data)
}

export const GetPatientMyListAPI = () => {
  return request<PatientItem[]>('/patient/mylist', 'GET')
}

/**
 * 删除患者（家庭档案）
 */
export const DeletePatientAPI = (id: string) => {
  return request(`/patient/del/${id}`, 'DELETE')
}

/**
 * 患者详情（家庭档案）
 */
export const getPatientInfoByIdAPI = (id: string) => {
  return request<PatientInfoByIdParams>(`/patient/info/${id}`)
}

/**
 * 编辑（更新）患者（家庭档案）
 */
export const putPatientUpdateAPI = (data: PatientUpdateParams) => {
  return request(`/patient/update`, 'PUT', data)
}

/**
 * 获取患者列表
 */
export const getPatientListAPI = (id: string) => {
  return request<PatientItem>(`/patient/info/${id}`)
}
